#! /bin/sh

ROOT_DIR=$(pwd)

# build and install dependencies
DEPS="onion jsoncpp surbasic gwlib"
for d in $DEPS; 
do 
    cd $ROOT_DIR
    mkdir -pv $d/build
    cd $d/build
    cmake -DBoost_NO_BOOST_CMAKE=ON ../
    make -j4
    if [ "$d" = "jsoncpp" ]; then
        make install
    fi
done

# Clone and build FUSE client
cd $ROOT_DIR
mkdir -pv sur_fuse/build
cd sur_fuse/build
cmake ../
make -j4

# Clone and build Gateway Server
cd $ROOT_DIR
mkdir -pv gateway/build
cd gateway/build
cmake -DBoost_NO_BOOST_CMAKE=ON -DCLOUD_BACKEND=PER ../
make -j4
